using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using CMS.Core.DataInterfaces;
using CMS.Core.Domain;
using CMS.Data;
using AjaxPro;
using CMS.Presenters.Views.Lookups;

namespace CMS.Presenters.Presenters
{
    public class LookupTiepDanPresenter
    {
        ITiepDanDao iTiepDanDao;
        ILookupTiepDanView iLookupTiepDanView;

        public LookupTiepDanPresenter()
        { 
        
        }

        public LookupTiepDanPresenter(ILookupTiepDanView iLookupTiepDanView)
        {
            this.iLookupTiepDanView = iLookupTiepDanView;
            this.iLookupTiepDanView.LinhVucs = new LinhVucDao().GetFieldEqualCriteria("TrangThai", true);
            this.iLookupTiepDanView.LoaiHinhs = new LoaiHinhDao().GetFieldEqualCriteria("TrangThai", true);
        }

        [AjaxMethod]
        public IList SearchTiepDans(string type, string txtTuNgay, string txtDenNgay, int maDiaBan,
                            int maLinhVuc, int maLoaiHinh, int bpTiep, string txt1, string txt2, string txt3,
                            int minSoThuLy, int maxSoThuLy, int min, int max
            )
        {
            this.iTiepDanDao = new TiepDanDao();
            return this.iTiepDanDao.SearchTiepDans(type, txtTuNgay, txtDenNgay, maDiaBan, maLinhVuc, maLoaiHinh,bpTiep,
                txt1, txt2, txt3, minSoThuLy, maxSoThuLy, min, max);
        }

        [AjaxMethod]
        public int TotalSearchTiepDans(string type, string txtTuNgay, string txtDenNgay, int maDiaBan,
                int maLinhVuc, int maLoaiHinh, int bpTiep, string txt1, string txt2, string txt3,
                int minSoThuLy, int maxSoThuLy
            )
        {
            this.iTiepDanDao = new TiepDanDao();
            return this.iTiepDanDao.TotalSearchTiepDans(type, txtTuNgay, txtDenNgay, maDiaBan, maLinhVuc, maLoaiHinh, bpTiep,
                txt1, txt2, txt3, minSoThuLy, maxSoThuLy);
        }       
    }
}
